home *** CD-ROM | disk | FTP | other *** search
/ 3D Images / 3D Images.iso / programs / amiga / batchfactory / scripts / imagemaster / im_images_to_lineart < prev    next >
Encoding:
Text File  |  1995-01-12  |  3.0 KB  |  121 lines

  1. /* 
  2.                       IMAGE MASTER IMAGES TO LINEART
  3.                                By J.L. White
  4.                           ©1994 Merlin's Software
  5.  
  6.                             Image Master Script
  7.  
  8.  Batch Factory Batch Conversion Scripts are basically Arexx scripts that
  9. allow you to pass certain parameters to the external program you wish
  10. to use to convert the images from one format to another. You can pass
  11. five different strings from Batch Factory to the script by using the
  12. following commands:
  13.  
  14. $N = This will pass the current selected filename.
  15. $P = This will tell Batch Factory to ask for a path to save new frames to.
  16. $# = This will pass the current frame number in the script.
  17. $T = This will pass the total number of frames in the script.
  18. $A = This will pass an offset number to be used to save frames with.
  19.  
  20. NOTE: The following line is required to work as a Batch Factory Script:
  21.  
  22. PARSE=$N $P $# $A $T
  23.  
  24. */
  25.  
  26. arg TheFile OutFile FrameNum AddNum TotalNum
  27. SaveNum = FrameNum + AddNum
  28. options results
  29.  
  30. call Locate_IM
  31.  
  32. address 'IM_Port'
  33. Buffers
  34. parse var result Name','Num','Fluff 
  35. if Num = 0 then Killbuff 0
  36. Path = GetPathName(TheFile)
  37. Pic = GetFileName(TheFile)
  38. if FrameNum = 1 then do
  39.     IMToFront
  40.     ImagePath Path
  41.     LoadAsPrimary Pic
  42.     'Gadgets "Do Operation On" "Entire Image",
  43.     "Do Operation On" "Selected Area"';
  44.     Selection = result;
  45.     if Selection = 1 then do
  46.         'entire'
  47.         end
  48.     if Selection = 2 then do
  49.         'area'
  50.         end
  51.     'SaveMask Ram:TempMaskLA'
  52.     'AskProp "Change % :" 50 0 100'
  53.     Answer = result
  54.     'AskProp "Threshold :" 127 0 255'
  55.     Answer2 = result
  56.     'Askyn "No Monochrome" "Monochrome"'
  57.     Answer3 = result
  58.     'Askyn "White Line" "Black Line"'
  59.     Answer4 = result
  60.     call open TempFile,"Ram:IMTLA",W
  61.     call writeln TempFile,Answer
  62.     call writeln TempFile,Answer2
  63.     call writeln TempFile,Answer3
  64.     call writeln TempFile,Answer4
  65.     call close TempFile
  66.     end
  67. else do
  68.     ImagePath Path
  69.     LoadAsPrimary Pic
  70.     'LoadMask Ram:TempMaskLA 1'
  71.     call open TempFile,"Ram:IMTLA",R
  72.     line = readln(TempFile)
  73.     parse var line Answer
  74.     line = readln(TempFile)
  75.     parse var line Answer2
  76.     line = readln(TempFile)
  77.     parse var line Answer3
  78.     line = readln(TempFile)
  79.     parse var line Answer4
  80.     call close TempFile
  81.     end
  82. if OutFile = "SAME" then do
  83.     Path = GetPathName(TheFile)
  84.     Pic = GetFileName(TheFile)
  85.     end
  86. else do
  87.     Path = GetPathName(OutFile)
  88.     Pic = GetFileName(OutFile)""right(SaveNum,3,'0')
  89.     end
  90. Lineart Answer Answer2 Answer3 Answer4
  91. Rename 0 Pic
  92. ImagePath Path
  93. Save 0
  94. if FrameNum = TotalNum then do
  95.     address command "delete >NIL: Ram:TempMaskLA"
  96.     address command "delete >NIL: Ram:IMTLA"
  97.     end
  98. Exit
  99.  
  100.  
  101. GetFileName: procedure  
  102.    ARG CompleteName
  103.    c = lastpos("/",CompleteName)
  104.    if c = 0 then c = lastpos(":",CompleteName)
  105.    return substr(CompleteName, c + 1)
  106.  
  107. GetPathName: procedure  
  108.    ARG CompleteName
  109.    c = lastpos("/",CompleteName)
  110.    if c = 0 then c = lastpos(":",CompleteName)
  111.    return left(CompleteName,c)
  112.  
  113. Locate_IM:
  114.     if (POS('IM_Port',SHOW('Ports')) = 0)
  115.     then do
  116.         address command 'run < nil: > nil: IMIMIM:IMF'
  117.         address command 'wait 10'
  118.     end
  119. return
  120.  
  121.